package swag.t;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.Toast;

public class HomeScreen extends Activity implements OnClickListener {
	Button bplay, bdifficulty, blives;
	int lives=3;
	int difficulty=1;
	@Override
	public void onCreate(Bundle savedInstanceState) {
		 super.onCreate(savedInstanceState);
	        setContentView(R.layout.homescreen);
	        bplay = (Button) findViewById(R.id.button3);
	        bdifficulty = (Button) findViewById(R.id.button2);
	        blives = (Button) findViewById(R.id.button1);
	        bplay.setOnClickListener(this);
	        blives.setOnClickListener(this);
	        bdifficulty.setOnClickListener(this);
	}
	
	
	
	
	
	public void onClick(View v) {
		// TODO Auto-generated method stub
		if(v.equals(bplay))
		{
			Intent intent = new Intent(this, BlobsOfMadness.class);
			intent.putExtra("Difficulty", difficulty);
			intent.putExtra("Lives", lives);
			this.startActivity(intent);
			
		}
		else if(v.equals(bdifficulty))
		{
			  AlertDialog.Builder alert = new AlertDialog.Builder(this);
		        alert.setTitle("What Skill Level Do You Wish To Play Blobs Of Madness In?");
		        alert.setMessage("Choose Wisely...");
		      
		        alert.setPositiveButton("1",new DialogInterface. OnClickListener(){

					public void onClick(DialogInterface dialog, int which) {
						// TODO Auto-generated method stub
						difficulty = 1;
						Toast.makeText(getBaseContext(), "Wimp",Toast.LENGTH_SHORT).show();
					}
		        	
				
		        });
		        alert.setNeutralButton("2", new DialogInterface. OnClickListener()
		        {

					public void onClick(DialogInterface dialog, int which) {
						// TODO Auto-generated method stub
						difficulty = 2;
						Toast.makeText(getBaseContext(), "Eh",Toast.LENGTH_SHORT).show();
					}
		        	
		        });
		        
		        alert.setNegativeButton("3", new DialogInterface. OnClickListener()
		        {

					public void onClick(DialogInterface dialog, int which) {
						// TODO Auto-generated method stub
						difficulty =3;
						Toast.makeText(getBaseContext(), "Daring!",Toast.LENGTH_SHORT).show();
						
					}
		        	
		        });
		       
		        alert.show();
		
		
		
		}
		else if(v.equals(blives))
		{
			 
	        AlertDialog.Builder alert2 = new AlertDialog.Builder(this);
	        alert2.setTitle("How many lives do you wish to play with?");
	        alert2.setMessage("Choose Wisely...");
	      
	        alert2.setPositiveButton("1",new DialogInterface. OnClickListener(){

				public void onClick(DialogInterface dialog, int which) {
					// TODO Auto-generated method stub
					lives = 1;
					Toast.makeText(getBaseContext(), "I like it!",Toast.LENGTH_SHORT).show();
				}
	        	
			
	        });
	        alert2.setNeutralButton("3", new DialogInterface. OnClickListener()
	        {

				public void onClick(DialogInterface dialog, int which) {
					// TODO Auto-generated method stub
					lives = 3;
					Toast.makeText(getBaseContext(), "Eh",Toast.LENGTH_SHORT).show();
				}
	        	
	        });
	        
	        alert2.setNegativeButton("5", new DialogInterface. OnClickListener()
	        {

				public void onClick(DialogInterface dialog, int which) {
					// TODO Auto-generated method stub
					lives = 5;
					Toast.makeText(getBaseContext(), "C'Mon Dude C'mon",Toast.LENGTH_SHORT).show();
					
				}
	        	
	        });
	       
	        alert2.show();    
	        
		}
	
	
	
	}
	

}
